import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

const login = resolve => require(['../components/login'], resolve) // 登录
const layout = resolve => require(['../components/layout'], resolve) // layout
const work = resolve => require(['../components/work/work1'], resolve) // 工作台
const welcome =  resolve => require(['../components/welcome'], resolve) //欢迎页

const rechargeList = resolve => require(['../components/money/recharge/list'], resolve) //充值列表
const auditList = resolve => require(['../components/money/audit/list'], resolve) //审核列表
const home = resolve => require(['../components/money/home/list'], resolve) //首页
const merchantList = resolve => require(['../components/money/merchant/list'], resolve) //商户列表
const expenseList = resolve => require(['../components/money/expense/list'], resolve) //消费明细列表
const excountList = resolve => require(['../components/money/excount/list'], resolve) //消费统计列表

const adminUserList = resolve => require(['../components/money/system/adminUser/list'], resolve) // 用户管理
const menuList = resolve => require(['../components/money/system/menu/list'], resolve) // 菜单管理
const roleList = resolve => require(['../components/money/system/role/list'], resolve) // 角色管理

export default new Router({
  // mode:'history',
  routes: [
    {
      path: '/',
      name: 'login',
      component: login
    },
    {
      path: '/login',
      name: 'login',
      component: login
    },
    {
      path: '/work',
      name: 'layout',
      component: layout,
      meta: {
        requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
      },
      children:[
        //欢迎页
        {
          path:'welcome',
          name:'welcome',
          component:welcome
        },
        //充值列表
        {
          path:'expense/recharge',
          name:'rechargeList',
          component:rechargeList
        },
        {
          path:'audit/list',
          name:'auditList',
          component:auditList
        },
        {
          path:'index/index',
          name:'home',
          component:home
        },
        //商户管理
        {
          path:'merchant/index',
          name:'merchantList',
          component:merchantList
        },
         //消费明细管理
        {
          path:'admin/statistics',
          name:'expenseList',
          component:expenseList
        },
        //消费统计
        {
          path:'expense/count',
          name:'excountList',
          component:excountList

        },
        //系统配置
        {
          path:'Admin/index',
          name:'adminUserList',
          component:adminUserList
        },
        {
          path:'menu/list',
          name:'menuList',
          component:menuList
        },
        {
          path:'Role/index',
          name:'roleList',
          component:roleList
        },
      ]
    }
  ]
})
